/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.sql.*;
import java.util.Vector;
import javax.swing.text.StyledEditorKit.BoldAction;

/**
 *
 * @author RUOL
 */
public class Khoa_sinhvien {
    private  int Madk;
    private String Masv;
    private String Malop;
    private java.util.Date Ngaydangky;
    private String Manv;

    public Khoa_sinhvien() {
    }

    public Khoa_sinhvien(int Madk, String Masv, String Malop, Date Ngaydangky, String Manv) {
        this.Madk = Madk;
        this.Masv = Masv;
        this.Malop = Malop;
        this.Ngaydangky = Ngaydangky;
        this.Manv = Manv;
    }

    /**
     * @return the Madk
     */
    public int getMadk() {
        return Madk;
    }

    /**
     * @param Madk the Madk to set
     */
    public void setMadk(int Madk) {
        this.Madk = Madk;
    }

    /**
     * @return the Masv
     */
    public String getMasv() {
        return Masv;
    }

    /**
     * @param Masv the Masv to set
     */
    public void setMasv(String Masv) {
        this.Masv = Masv;
    }

    /**
     * @return the Malop
     */
    public String getMalop() {
        return Malop;
    }

    /**
     * @param Malop the Malop to set
     */
    public void setMalop(String Malop) {
        this.Malop = Malop;
    }

    /**
     * @return the Ngaydangky
     */
    public java.util.Date getNgaydangky() {
        return Ngaydangky;
    }

    /**
     * @param Ngaydangky the Ngaydangky to set
     */
    public void setNgaydangky(java.util.Date Ngaydangky) {
        this.Ngaydangky = Ngaydangky;
    }

    /**
     * @return the Manv
     */
    public String getManv() {
        return Manv;
    }

    /**
     * @param Manv the Manv to set
     */
    public void setManv(String Manv) {
        this.Manv = Manv;
    }
    
    public Vector<Vector> DanhSachKhoa_sinhvien()
    {
        Vector<Vector> dsdm = new Vector<Vector>();
        
        try
        {
            Connection con = ConnectToDatabase.getConnection();
            String query = "select * from khoa_sinhvien where Masv='"+this.Masv+"'";
            Statement st=con.createStatement();
            ResultSet rs = st.executeQuery(query);
            while(rs.next())
            {
                Vector<Object> dm = new Vector<Object>();
                dm.add(rs.getString("Madk"));
                dm.add(rs.getString("Masv"));
                dm.add(rs.getString("Malop"));
                dm.add(rs.getDate("Ngaydangky"));
                dm.add(rs.getString("Manv"));
                dsdm.add(dm);
            }
        }
        catch(Exception ex)
        {
            dsdm = null;
        }
        
        return dsdm;
    }
    
}
